package acwing.双指针;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 统计数字
 *
 * @author yang
 * @date 2021/12/19
 */
public class 统计数字 {

    static int N = 200010;
    static long[] a = new long[N];
    static int n;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a,0, n);
        for (int i = 0; i < n; i++) {
            int j = i;
            while (a[j] == a[i] && j < n) j++;
            System.out.println(a[i] + " " + (j - i));
            i = j - 1;
        }
    }
}
